#coding:utf-8
'''
Created on 2013-1-28

@author: edsion
'''
import smtplib
import base64
from email.mime.text import MIMEText

mail_user = base64.decodestring("ZWRzaW9uQDIxa3VucGVuZy5jb20=")
mail_pwd = base64.decodestring("ejIwMDIwMTA1OA==")
mail_to = 'edsion@21kunpeng.com'
mail_host = 'smtp.exmail.qq.com'
mail_cc = '463614195@qq.com'
content = 'this is a mail sent with python'

#表头信息
msg = MIMEText(content)
msg['From'] = mail_user
msg['Subject'] = 'this is a python test mail'
msg['To'] = mail_to
msg['Cc'] = mail_cc
try:
    s = smtplib.SMTP()
    s.connect(mail_host)
    #login
    s.login(mail_user,mail_pwd)

    #send mail
    s.sendmail(mail_user,[mail_to,mail_cc],msg.as_string())
    s.close()
    print 'success'
except Exception ,e:
    print e
